// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import store from '@/store'
import router from '@/router'
import ElementUI, { Loading, MessageBox } from 'element-ui'
import zhCN from 'vee-validate/dist/locale/zh_CN'
import VeeValidate, { Validator } from 'vee-validate'
import utils from '@/tools/utils'
import valiMsg from '@/components/public/ValiMsg'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

import 'element-ui/lib/theme-chalk/index.css'
// import 'element-ui/lib/theme-default/index.css'
import '@/assets/icon/iconfont.js'
// import '@/tools/array.js'

Validator.localize('zh_CN', zhCN)
const config = {
  errorBagName: 'errors', // change if property conflicts.
  fieldsBagName: 'fieldsvee',
  delay: 0,
  strict: true,
  events: 'input',
  locale: 'zh_CN'
}

// 富文本编辑器
Vue.use(VueQuillEditor)

Vue.use(VeeValidate, config)

Vue.prototype.$confirm = MessageBox.confirm
Vue.prototype.sleep = function (s) {
  return new Promise(resolve => setTimeout(resolve, parseInt(s * 1000)))
}

Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(Loading)

Vue.mixin(utils)

Vue.component('vali-msg', valiMsg)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  render: h => h(App)
})
